<template>
  <uv-popup ref="popup" mode="center" round="20" :safeAreaInsetBottom="false" :closeOnClickOverlay="false">
    <view class="box">
      <!-- 标题 -->
      <view class="title">提示</view>
      <!-- 内容 -->
      <view class="content">{{ text }}</view>
      <!-- 按钮 -->
      <view>
        <view v-if="isSingle">
          <view class="w-[242rpx] h-[76rpx] rounded-full flex items-center justify-center bg-primary text-white ml-[110rpx] xy-font-26" @click="sure">确定</view>
        </view>
        <view v-else class="btn-box">
          <view class="cancel-box" @click="close">取消</view>
          <view class="sure-box" @click="sure">确定</view>
        </view>
      </view>
    </view>
  </uv-popup>
</template>

<script setup>
import { ref } from 'vue';
const props = defineProps({
  text: {
    type: String,
    default: '您确定要退出登录吗？'
  },
  isSingle: {
    type: Boolean,
    default: false,
  }
})
const emit = defineEmits(['sure'])
const popup = ref(null) // 弹窗实例
const open = () => {
  popup.value?.open()
}
const close = () => {
  popup.value?.close()
}
const sure = () => {
  close()
  emit('sure')
}

defineExpose({
  open,
  close,
})
</script>

<style lang="scss" scoped>
.box {
  width: 550rpx;
  background-color: #fff;
  border-radius: 16rpx;
  overflow: hidden;
}
.title {
  margin-top: 40rpx;
  font-size: 32rpx;
  font-weight: bold;
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.content {
  margin-top: 32rpx;
  margin-bottom: 44rpx;
  font-size: 32rpx;
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-box {
  margin: 0 44rpx 48rpx;
  display: flex;
  justify-content: space-between;
}
.cancel-box {
  height: 76rpx;
  border-radius: 9999px;
  border: 1px solid #F7F8F9;
  color: #000;
  flex: 1 1 0%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 32rpx;
  font-size: 26rpx;
}
.sure-box {
  height: 76rpx;
  border-radius: 9999px;
  background-color:#22B3FC;
  flex: 1 1 0%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 26rpx;
}
</style>